home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_075 / copy / cp.doc < prev    next >
Text File  |  1992-05-06  |  3KB  |  69 lines

  1.       Cp - a replacement for AmigaDos Copy that retains the date.
  2.  
  3.         by Jeff Lydiatt
  4.         Vancouver, Canada
  5.         Release 1.0, May 17, 1987
  6.  
  7.       Cp and the c source is freely redistributable for personal
  8.       non-commercial use.  Commercial rights are reserved by the
  9.       author.  Feel free to make any modifications or use any 
  10.       of the modules in other programs.  I encourage you to do so
  11.       and hope you will release the code so others can learn by it.
  12.  
  13. Cp has most of the features of the AmigaDos copy command:
  14. --------------------------------------------------------
  15.  
  16.    o Cp supports the AmigaDos style pattern matching in the "from" name.
  17.    o Cp supports the All option.
  18.    o Cp supports the optional "from" and "to" qualifiers for file names.
  19.    o Cp will copy directories
  20.  
  21. Cp has a number of features not found in AmigaDos copy:
  22. -------------------------------------------------------
  23.  
  24.    o Cp will retain the date of the copied file.
  25.    o Cp uses a 32000 byte buffer, which speeds copies when the from and
  26.      to file is on the same disk.
  27.    o You may specify the current directory by a "to" name of ".".  For
  28.      example if your current directory is "Df0:",
  29.         "cp ram:x ."
  30.      will copy the file called x in your ram: disk to "df0:x".
  31.    o Cp will also create the "to" file for you if you use the "All"
  32.      option.  For example if "x" is a directory,
  33.              "cp from x to y"
  34.      will create a directory called "y", and will copy all the files in
  35.      x to the newly created "y" directory.
  36.  
  37. About the AmigaDos-style pattern matching.
  38. -----------------------------------------
  39.  
  40.    Cp uses a compact function for regular expression pattern matching.
  41. The algorithm was taken from a paper by Martin Richards, that was
  42. published in the September 1979 issue of "Software, Practice and
  43. Experience".  Professor Richards published his example in BCPL, and
  44. I have (sucessfully I think) translated it to C.  It's interesting to
  45. note that I translated it verbatim, with no special modifications to
  46. adapt it to AmigaDos conventions.
  47.  
  48.   Cp recognises a number of special characters with special meanings,
  49. which can be used to recognise any other charcaters that match them. 
  50.  
  51.   ?    Matches any single character.
  52.   %    Matches the null character.
  53.   #<p>  Matches zero or more occurrences of the pattern <p>
  54.   <p1>|<p2> Matches either pattern <p1> or <p2>.
  55.   ()    Can be used to group expressions together.
  56.   '#    Can be used to turn off the special meaning of the special
  57.         characters #, ?, %, |, (, ), or '.  
  58.  
  59.   Some examples will help to make this clearer.
  60.  
  61.   cp a|b .    copies a or b to the current directory.
  62.   cp a#bc .    copies ac abc abbc.
  63.   cp a#(b|c)d .    copies ad abd abcd.
  64.   cp a?b .    copies axb ayb aab.
  65.   cp a#?b    copies ab axxb ax.ab.
  66.   cp '?#?'# .    copies ?# ?ab# ??##.
  67.   cp a(b|%)#c . copies a abc accc.
  68.  
  69.